package me.hl.zk;

import org.junit.Test;

/**
 * author: planck
 * createTime: 2016/12/2.
 */
public class ZkDemo {
    @Test
    public void leaderTest() throws Exception {

        //模拟三个应用抢leader
        new Thread(() -> {
            try {
                new ZkTest().testLeader();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }).start();

        Thread.sleep(5000);

        new Thread(() -> {
            try {
                new ZkTest().testLeader();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }).start();

        new Thread(() -> {
            try {
                new ZkTest().testLeader();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }).start();
        Thread.sleep(15000);
    }


}
